'use strict';

const BaseController = require('../sys/base');
const qiniu = require('../../utils/qiniu');

class StaffController extends BaseController {

  // 添加员工
  async add() {
    const { ctx } = this;
    let postData = ctx.request.body;
    let result = await ctx.service.organization.staff.add(postData);
    this.success(result);
  }

  // 获取活动列表
  async list() {
    const { ctx } = this;
    const query = ctx.request.query;
    let result = await ctx.service.organization.staff.list(query);
    this.success(result);
  }

  // 删除员工
  async delete() {
    const { ctx } = this;
    const requestData = ctx.request.query;
    const result = await ctx.service.organization.staff.delete(requestData);
    this.success(result);
  }

  // 更新员工
  async update() {
    const { ctx } = this;
    const requestData = ctx.request.body;
    let result = await ctx.service.organization.staff.update(requestData);
    this.success(result);
  }

  // 添加权限     
  async updateStaffAuthority() {
    const { ctx } = this;
    const postData = ctx.request.body;
    const result = await ctx.service.organization.staff.updateStaffAuthority(postData);
    this.success(result);
  }
}

module.exports = StaffController;
